/**
 * Created by lizhe on 2018/4/17.
 */
var datas = [];
var first = [];
var second = [];
var third = [];

var menuId = 0;
var type = "";
var next = "";
$(document).ready(function(){
    menuId = getQueryString("menuId");
    type = getQueryString("type");
    next = getQueryString("next");
    queryList2(menuId);
    queryInfo(1,100000,menuId);
});

function queryInfo(page,pageSize,menuId){
    $.ajax({
        url : urladdr + "/web/article/list",
        method : "GET",
        data : {
            page:page,
            pageSize:pageSize,
            menuId:menuId,
            status:2
        },
        success : function(data){
            if(data.code == 0){
                $("#content").empty();
                $.each(data.data.list,function(i,date){
                    var ext = JSON.parse(date.ext);
                    var moto = ext.moto;
                    var position = ext.position;
                    var icon =  imgUrl + date.imageUrl;
                    document.getElementById("content").innerHTML = document.getElementById("content").innerHTML +
                        '<div class="teacherDivOut" style="background: rgba(255,255,255,0);" onmousemove="mouseMove(this)" onmouseout="mouseOut(this)">'+
                        '<div class="teacherDiv" onclick=toInfo("'+date.id+'")>'+
                        '<div class="teacherImgDiv">'+
                        '<img src="'+icon+'" class="teacherImg">'+
                        '<div class="teacherPost">'+ position +'</div>'+
                        '</div>'+
                        '<div class="teacherInfo">'+
                        '<div class="teacherName">'+ date.title +'</div>'+
                        '</div>'+
                        '</div>'+
                        '</div>'
                });
            }else if(data.code == 401){
                location.href = "index.html"
            }else{
                modalinfo(data.msg);
            }
        }
    });
}

function toInfo(id){
    location.href = "teacherText.html?menuId="+menuId + "&id="+id + "&next="+next;
}

function mouseMove(obj){
    obj.style.background = "rgba(255,255,255,1)";
}

function mouseOut(obj){
    obj.style.background = "rgba(255,255,255,0)";
}